package cn.zt.controller;

import cn.zt.common.Result;
import cn.zt.domain.BankCardType;
import cn.zt.service.BankCardTypeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("BankCardType")
public class BankCardTypeController {

    @Resource
    private BankCardTypeService bankCardTypeService;

    //通过id查询
    @GetMapping("selectbyid")
    public BankCardType selectById(@RequestParam("id") Integer id) {
        return bankCardTypeService.selectById(id);
    }

    //添加银行卡类型
    @PostMapping("addbandcardtype")
    public int addBankcardType(@RequestBody BankCardType bankCardType) {
        return bankCardTypeService.addBankcardType(bankCardType);
    }

    //查询所有的1类卡
    @GetMapping("selectOneType")
    public List<BankCardType> selectOneType() {
        return bankCardTypeService.selectOneType();
    }

    //通过银行卡的主键获取类型表中的数据
    @GetMapping("selectByBankCard")
    public Integer selectByBankCard(@RequestParam("id") Integer id){
        return bankCardTypeService.selectA(id);
    }


}
